package com.example.bms.serviceimpl;

import com.example.bms.entity.Admin;
import com.example.bms.entity.Student;
import com.example.bms.entity.Teacher;
import com.example.bms.mapper.LoginMapper;
import com.example.bms.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


/**
 * @apiNote 用于对判断题的增加和查询
 * @author 扶纪权
 * @email 1605009600@qq.com
 * @since 1.0.0
 */
@Service
@Transactional
public class LoginServiceImpl implements LoginService {

    @Autowired
    private LoginMapper loginMapper;


    /**
     * @apiNote 验证账号密码是否正确
     * @author 钟顺浩
     * @param username 账号
     * @param password 密码
     * @email 2918185121@qq.com
     * @return Admin
     * @since 1.0.0
     */
    public Admin adminLogin(Integer username, String password) {
        return loginMapper.adminLogin(username,password);
    }


    /**
     * @apiNote 验证账号密码是否正确
     * @author 钟顺浩
     * @param username 账号
     * @param password 密码
     * @email 2918185121@qq.com
     * @return Teacher
     * @since 1.0.0
     */
    public Teacher teacherLogin(Integer username, String password) {
        return loginMapper.teacherLogin(username,password);
    }


    /**
     * @apiNote 验证账号密码是否正确
     * @author 钟顺浩
     * @param username 账号
     * @param password 密码
     * @email 2918185121@qq.com
     * @return Student
     * @since 1.0.0
     */
    public Student studentLogin(Integer username, String password) {
        return loginMapper.studentLogin(username,password);
    }
}
